UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XVF6xdhimHECHo97tQAJSLbT8GOQWWxyBM/rE2jsVo8=' 
WHERE 
  key_id = 'edcf6e51ca8a2ccbd38975e0c06f9099962d56bdbb158b878c053c16f11256ed' 
  AND (
    token = 'XVF6xdhimHECHo97tQAJSLbT8GOQWWxyBM/rE2jsVo8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026