UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZLqvgGv+uknnT5p8ExwGjHreMau7UeUeZot0ay97/u4=' 
WHERE 
  key_id = '8b73461c85794c98f5e4f7441e5002f52161b0668fef8188c8380dd4e2bb14b0' 
  AND (
    token = 'ZLqvgGv+uknnT5p8ExwGjHreMau7UeUeZot0ay97/u4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033