UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tj3iFX9IF9/qRntEVm2mPNfb4BKFARW/8hMbCBdbU80=' 
WHERE 
  key_id = '0a7813a957b3f396f945387994cabec47a8970b85bcb05c78f54be73016cf860' 
  AND (
    token = 'Tj3iFX9IF9/qRntEVm2mPNfb4BKFARW/8hMbCBdbU80=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018