UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NfxFOk5nXWoTKHEB48AXMuk4VtxRrMJwmBidSlIn4PY=' 
WHERE 
  key_id = '280c996b5b14986ade8b43763f2ecbdcc577888514cefc38339640894e2d53ac' 
  AND (
    token = 'NfxFOk5nXWoTKHEB48AXMuk4VtxRrMJwmBidSlIn4PY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026