UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mv4RP/8O9Zjwik6S/ulqZtujsVITvqlZwGQ0cHMPU44=' 
WHERE 
  key_id = '588a19a61eb582f5dc4bf5f622eca298108143f7540b478590ca3c8d6e3adf10' 
  AND (
    token = 'mv4RP/8O9Zjwik6S/ulqZtujsVITvqlZwGQ0cHMPU44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051