UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bdTQG50xPhh3f2G+KsYqW2puxNVmgS5YuV35F1NLIeE=' 
WHERE 
  key_id = '510fa05bb385c668d3c1621fd251cced0944a7c2f68d2071f9cec47e9a0fc871' 
  AND (
    token = 'bdTQG50xPhh3f2G+KsYqW2puxNVmgS5YuV35F1NLIeE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032