UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQizy90NNNma4+EEv5R/dwMY3gtrFm2mqeYaeShq7ug=' 
WHERE 
  key_id = 'f694f9767964d39f5b6a659b0037964c1886d315dbd2150513dee1c0db02a1ca' 
  AND (
    token = 'lQizy90NNNma4+EEv5R/dwMY3gtrFm2mqeYaeShq7ug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018