UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GB/Kk3mji7fdQAdkY9hjnPNjnk6IN6SdfzxdV9KbNko=' 
WHERE 
  key_id = '39db8cd3ddf551e3371485d3035f7caf517609c819156c109deb54588329edc4' 
  AND (
    token = 'GB/Kk3mji7fdQAdkY9hjnPNjnk6IN6SdfzxdV9KbNko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037