UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e0lj3ukszgEd3Pcj8tvTaDOj3gNIE4TI8UWdLEFVFDg=' 
WHERE 
  key_id = '5d6d5cfe4e6975a4e654282c8b2df03e3fbc8bca1eff7e6eb0e12b3863b91af6' 
  AND (
    token = 'e0lj3ukszgEd3Pcj8tvTaDOj3gNIE4TI8UWdLEFVFDg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044