UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BiFhDDDao3NZiZ39iLgsUc47WFBzjPFPuIU2/ZM39CQ=' 
WHERE 
  key_id = 'c39678c334ba91acb65bd7e0a00a3d59b535c64d731caa75f6947cf0b9f775e6' 
  AND (
    token = 'BiFhDDDao3NZiZ39iLgsUc47WFBzjPFPuIU2/ZM39CQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050