UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DnGIUfU1DO2IVPInf8PtLKcYX9oUL8EThLvPbT5iNqE=' 
WHERE 
  key_id = '8f28409ca2a77ff35950d512360040ad98e4d6bf72950db30c138b35659e8582' 
  AND (
    token = 'DnGIUfU1DO2IVPInf8PtLKcYX9oUL8EThLvPbT5iNqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019