UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9P8Ls2eaKvtyyNwKiR/Rx8vu8ILtofRUUi78tFlHHI=' 
WHERE 
  key_id = '5a02155400f70d64c256c5acc5276fd7fb23d37da064662c63d8fcfa92a8e5d9' 
  AND (
    token = 'q9P8Ls2eaKvtyyNwKiR/Rx8vu8ILtofRUUi78tFlHHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031