UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XCAT5FFfOHgxh/SaEKSQw1bzm92PufgjdZ3Fap3JdmY=' 
WHERE 
  key_id = 'e33d3d890a986545b371f03e16c7ff7b6764d107befed035ccab96d3ee092514' 
  AND (
    token = 'XCAT5FFfOHgxh/SaEKSQw1bzm92PufgjdZ3Fap3JdmY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021