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

Query time 0.00043