UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XGNk5XU45xwryIPtFazOGEe8tkOaF5wOhgO08LujPjM=' 
WHERE 
  key_id = 'b65d1cd99febbfe6fd91c2a940ef00115fb9be3cb89214e54d511d8f728bb773' 
  AND (
    token = 'XGNk5XU45xwryIPtFazOGEe8tkOaF5wOhgO08LujPjM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021