UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kK+Vrd0SGxdq29iAyDUQM1cQoN5fLz+965ejxfpN9Hg=' 
WHERE 
  key_id = '06726a4c057ae315ce7becff0e5a9f5b374e964e5219b8ccc7ae8199e893748d' 
  AND (
    token = 'kK+Vrd0SGxdq29iAyDUQM1cQoN5fLz+965ejxfpN9Hg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026