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

Query time 0.00042