UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm94+6/5QcsTVDPrOh99e+0AqG7G5TUC5gLox/bnAfTs=' 
WHERE 
  key_id = '312e242b2394765c59a88a078a0f5bb1dc9e1e1367baf3e8793ce6cd8d26f02b' 
  AND (
    token = 'm94+6/5QcsTVDPrOh99e+0AqG7G5TUC5gLox/bnAfTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034