UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zXirAZRhqHEKTSBUcLCQaL+1w8xPB70DnZzUKsEcfVU=' 
WHERE 
  key_id = '0fadc0b7cdff28d965b3924d7afff1ee647209e130efcfbeb9e72b72400497ce' 
  AND (
    token = 'zXirAZRhqHEKTSBUcLCQaL+1w8xPB70DnZzUKsEcfVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018