UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77Db1skgvKG6b8SQ2QPGMXLCd0P2ya9dNuKDebdBMfk=' 
WHERE 
  key_id = '60b9a6763dd21f5dd2972c5e3783d87060fb79002e9b850412e64ee9fec892ad' 
  AND (
    token = '77Db1skgvKG6b8SQ2QPGMXLCd0P2ya9dNuKDebdBMfk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023