UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmWf6r+1Pm4p6LN9tx93hi7h9hIt6OrcHR3h7lsdSNM=' 
WHERE 
  key_id = '7bb94b3072a01e108355221da04266a0b8142393e35d64c33be53f6248946176' 
  AND (
    token = 'jmWf6r+1Pm4p6LN9tx93hi7h9hIt6OrcHR3h7lsdSNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030