UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A2Fgg5x4RbZv/J4z4OpSp3bt9AbYJqNSFa26EpFwsFM=' 
WHERE 
  key_id = '030fbf8963f9d53cc52dee3ba060e6d17970e4a2a0867911986d0d82fa939440' 
  AND (
    token = 'A2Fgg5x4RbZv/J4z4OpSp3bt9AbYJqNSFa26EpFwsFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046