UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HKiFXSIBy6zE4qgyLNjl6bMNfiawrp6b0+3WW1l7FnI=' 
WHERE 
  key_id = 'e08d1916e205203c86196193e0f699b78e9dd73408ad325f28df0fe0c92d7230' 
  AND (
    token = 'HKiFXSIBy6zE4qgyLNjl6bMNfiawrp6b0+3WW1l7FnI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045