UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zis0QQPfsLqDAqkk0G2b/G6HDeNy9IH0SoKmzlXUGD8=' 
WHERE 
  key_id = '851c08003727296ccbe62010e2701b3e599879d78d59a84583270676cad2284e' 
  AND (
    token = 'zis0QQPfsLqDAqkk0G2b/G6HDeNy9IH0SoKmzlXUGD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046