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

Query time 0.00038