UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WtVZRm5acQ1RKIottULc4YLhYGgyE3FKOosxNpi433k=' 
WHERE 
  key_id = '74b0639bddf4e786f089b12fcd1d1e5ed4fd9b58a5dd2c300291a1ea1da6ec6b' 
  AND (
    token = 'WtVZRm5acQ1RKIottULc4YLhYGgyE3FKOosxNpi433k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051