UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'srKmfFBL6jpKkG2xa0I3IyBvzQgta7YrcDKe3Ubcpj4=' 
WHERE 
  key_id = '57fa69813591c45f4a4f40e1f49902600d4303c9c0cb2eade8c439e7ca974e83' 
  AND (
    token = 'srKmfFBL6jpKkG2xa0I3IyBvzQgta7YrcDKe3Ubcpj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019