UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wd0GCPqSE7NjQ95yj8rB0bj3DsCuPzPofcn6pwNRJjU=' 
WHERE 
  key_id = 'f476c2b379ce4c36e60dcfd5a46e4b179f700644a773dcd3679424f679191318' 
  AND (
    token = 'Wd0GCPqSE7NjQ95yj8rB0bj3DsCuPzPofcn6pwNRJjU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043