UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sB7brCTAOYgimcO/2MvJcd54UbeRk9iYRpB8o0OOqCw=' 
WHERE 
  key_id = '1dd767ba31a20da3e41a7fbb1b8f2f039e5e110e40554bc8b761918d18c763ac' 
  AND (
    token = 'sB7brCTAOYgimcO/2MvJcd54UbeRk9iYRpB8o0OOqCw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045