UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pXOLDptvsmr0FG07lpDJsG6BYxsSZZcIt43p+SCEs+I=' 
WHERE 
  key_id = '283845e156163511b5bfa33bb25ee17989ee135885ecc0c9d2b80578187d2f6f' 
  AND (
    token = 'pXOLDptvsmr0FG07lpDJsG6BYxsSZZcIt43p+SCEs+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033