UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zdFvOdTMrd6YrK9faPo1wJECs5tLY3yiJt8xo/BcezU=' 
WHERE 
  key_id = '949f7c275db7494b0d0e21a24359c70fb375282b615967c2cf5ef8e974e13866' 
  AND (
    token = 'zdFvOdTMrd6YrK9faPo1wJECs5tLY3yiJt8xo/BcezU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029