UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iJkLQ4LzfRlx9AZtxA431rDo7fUc3DIaGPcmHAqOY+Q=' 
WHERE 
  key_id = '29159edb586c91ac3a5d535be6dfe2eb268814824118293fe374f53cbd195605' 
  AND (
    token = 'iJkLQ4LzfRlx9AZtxA431rDo7fUc3DIaGPcmHAqOY+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031