UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ElgwfAEIb5wcfKdVjgPiP7ds2nniOsbFOjQrTT1+6k=' 
WHERE 
  key_id = 'c590263ff4d799754d46d5c5e2793590e9d82668a577b913629c3b870382cfe2' 
  AND (
    token = '5ElgwfAEIb5wcfKdVjgPiP7ds2nniOsbFOjQrTT1+6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023