UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'USIIBQzndf5d+goFsHD1HyuXe0ziBQJrzvfhgImuQ/Y=' 
WHERE 
  key_id = '7164ab0cdd7d2396edcabed9c73d08b0574e2151d8761826c48ef7b358b31eb8' 
  AND (
    token = 'USIIBQzndf5d+goFsHD1HyuXe0ziBQJrzvfhgImuQ/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024