UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vIDW1DVimxhxHOXi0vWWHpfn3jZChQ4PN6qsxrIVfpE=' 
WHERE 
  key_id = '60399eff647c30dfeac0c11e172e8fecdf2d53216aa44741ad341c99e58b5aad' 
  AND (
    token = 'vIDW1DVimxhxHOXi0vWWHpfn3jZChQ4PN6qsxrIVfpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032