UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LzY/hAfnnv1s3G7isdd+AzDhPtEZnS9MQx12B3wSvuA=' 
WHERE 
  key_id = '3f77725090bacda6263c664d30adcc739de0f298a09768775fac1dda283197c4' 
  AND (
    token = 'LzY/hAfnnv1s3G7isdd+AzDhPtEZnS9MQx12B3wSvuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032