UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bfMVhBJrgq92nof21jkdMc3N3g4TVqazYWrrRysCvkE=' 
WHERE 
  key_id = 'd65fce36f58f5507dc638c3d5308382517418ce3a05cfe86214edc2c6852a626' 
  AND (
    token = 'bfMVhBJrgq92nof21jkdMc3N3g4TVqazYWrrRysCvkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024