UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b551HTLn79oe7jJAUujr8k59eJJi4xZW2XMwB+bRWWo=' 
WHERE 
  key_id = 'f3dac3035524c4ceee618552a65455bd2c06058a1dc2257fff69d5f941a80bb5' 
  AND (
    token = 'b551HTLn79oe7jJAUujr8k59eJJi4xZW2XMwB+bRWWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026