UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1js9hzi/8frInjZ8HIOzuM0W8a6VRHFxBowbpgL33+A=' 
WHERE 
  key_id = '178b8f2193f4f4b8d5b80d60b49630d72b9124d6dbadd940e08f55524d3b2e09' 
  AND (
    token = '1js9hzi/8frInjZ8HIOzuM0W8a6VRHFxBowbpgL33+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026