UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mf9ocs/KSgzWu0G2vPZI2g9RqXTAj+UW4+Hn5GHiYeY=' 
WHERE 
  key_id = '5c378e0d4e76f73070743d1661cb5d9d313c794c50ec6c2196fdeac1017dd6f8' 
  AND (
    token = 'mf9ocs/KSgzWu0G2vPZI2g9RqXTAj+UW4+Hn5GHiYeY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053