UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PzA0aRCdWhjJR+TvGt3YUSeRUk7wadwlitymmJFucgI=' 
WHERE 
  key_id = 'bf5cd186b26c11d86f8e5f6fbd8a0126d84a44efd6f8115568b1cc1b7fbb0a40' 
  AND (
    token = 'PzA0aRCdWhjJR+TvGt3YUSeRUk7wadwlitymmJFucgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024