UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v5yTvZu8FjsUpNXFJI5LL/N1uwjAvE/xbJDCODLscLM=' 
WHERE 
  key_id = '576afe326f82d02f98785fa8d5f7cbca82a8ce054fb99e099e0d9660bae73f3e' 
  AND (
    token = 'v5yTvZu8FjsUpNXFJI5LL/N1uwjAvE/xbJDCODLscLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032