UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fl5AyLXE7yVK+d2Qc6SC1dGZ4dImibGu/3/J2VYCZYQ=' 
WHERE 
  key_id = '5398a452323c4afb0191322f2d835faae87176a7778616feb79531dcbc56f462' 
  AND (
    token = 'fl5AyLXE7yVK+d2Qc6SC1dGZ4dImibGu/3/J2VYCZYQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043